enum GameLayerEnum {
	Map,
	Bottom,
	Normal, // main ui
	Effect, // redpackage
	Drama,
	Top, // alter,dlg_main_topbottom
	Tips, // item tips..
	Num,
}

type LayerType = egret.DisplayObjectContainer;

class UILayer extends eui.Component {
	constructor() {
		super();
		fullAlign(this);
	}
}

class UILayers extends eui.Component {
	layers: LayerType[] = [];

	constructor() {
		super();
		this.touchEnabled = false;
		this.touchChildren = true;
		this.createLayers();
	}

	createLayers(): void {
		for (let i = 0; i < GameLayerEnum.Num; i++) {
			const layer = new egret.DisplayObjectContainer();
			this.addChild(layer);
			this.layers[i] = layer;
		}
	}

	setSize(w: number, h: number): void {
		this.width = w;
		this.height = h;
		for (let i = 0; i < GameLayerEnum.Num; i++) {
			const layer = this.layers[i];
			layer.width = w;
			layer.height = h;
		}
	}

	getLayer(layer: number): LayerType {
		return this.layers[layer];
	}

	mainLayer(): LayerType {
		return this.getLayer(GameLayerEnum.Normal);
	}

	effectLayer(): LayerType {
		return this.getLayer(GameLayerEnum.Effect);
	}
}
